/**
* 选择的工具类
*/
const utilSelect = {
  /**
   * @Description：选择仓库
   * @Date 2023-10-17
   * @param confirm确认回调函数
   * @param idNe 需要排除的仓库id
  */
  warehouse(confirm, idNe, flagCenter) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    let subtitle = '<span class="span-msg">当前用户所拥有的仓库</span>'
    if (global.strings.isNotBlank(idNe)) {
      wrapper.ne('id', idNe)
    }
    if (global.strings.isNotBlank(flagCenter)) {
      wrapper.eq('flagCenter', flagCenter)
      if (global.constCommon.trueValueList.includes(flagCenter)) {
        subtitle+='<span class="span-msg">中心仓库</span>'
      } else {
        subtitle+='<span class="span-msg">非中心仓库</span>'
      }
    }

    home.selectWrapper.warehouse = wrapper
    home.selectWrapper.warehouseSubtitle = subtitle
    home.$refs.tableDrawerWarehouse.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    })
  },
  /**
   * @Description：选择机构-单选
   * @Date 2023-10-17
   * @param defaultActivedId 选中节点
   * @param confirm确认回调函数
  */
  officeOne(defaultActivedId, confirm) {
    let home = global.vue.$children[0].$children[0]
    home.$refs.treeOfficeDrawer.show(defaultActivedId, (row) => {
      if (confirm) {
        confirm(row)
      }
    })
  },
  /**
   * @Description：选择机构-多选
   * @Date 2023-10-17
   * @param defaultActivedId 选中节点
   * @param confirm确认回调函数
  */
  officeMore(defaultActivedId, confirm) {
    let home = global.vue.$children[0].$children[0]
    home.$refs.treeOfficeDrawer.showMore(defaultActivedId, (rows) => {
      if (confirm) {
        confirm(rows)
      }
    })
  },
  /**
   * @Description：供应商选择-单个
   * @Date 2023-10-17
   * @param confirm确认回调函数
   * @param flagDisabledSp   供应商是否禁用
   */
  supplier(confirm, flagDisabledSp = false) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    let subtitle = ''
    if (global.strings.isNotBlank(flagDisabledSp)) {
      wrapper.eq('flagDisabled', flagDisabledSp)
      if (global.constCommon.trueValueList.includes(flagDisabledSp)) {
        subtitle+='<span class="span-msg">已禁用供应商</span>'
      } else {
        subtitle+='<span class="span-msg">未禁用供应商</span>'
      }
    }
    home.selectWrapper.supplierSubtitle = subtitle
    home.selectWrapper.supplier = wrapper
    home.$refs.tableDrawerSupplier.show((row) => {
      if (confirm) {
        confirm(row)
      }
    })
  },
  /**
   * @Description：供应商选择-单个
   * @Date 2023-10-17
   * @param confirm确认回调函数
   */
  mfg(confirm) {
    let home = global.vue.$children[0].$children[0]
    home.selectWrapper.mfgSubtitle = '当前系统所有厂商'
    home.$refs.tableDrawerMfg.show((row) => {
      if (confirm) {
        confirm(row)
      }
    })
  },
  /**
   * @Description：科室选择-单个
   * @Date 2023-10-17
   * @param confirm确认回调函数
   * @param busTypeEq 业务类型 = 该值
   * @param busTypeNe 业务类型 != 该值
   */
  dept(confirm, busTypeEq, busTypeNe) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    wrapper.ne('flagDisabled', 1)
    wrapper.eq('flagBus', 1)
    let subtitle = '当前系统用户所拥有的未禁用的业务科室'
    if (global.strings.isNotBlank(busTypeEq)) {
      wrapper.eq('busType', busTypeEq)
      subtitle+= ',业务类型为' + global.utils.getDictLabel(busTypeEq, global.constCommon.dictType.baseDeptType, '', false)
    }
    if (global.strings.isNotBlank(busTypeNe)) {
      wrapper.ne('busType', busTypeNe)
      subtitle+= ',业务类型非' + global.utils.getDictLabel(busTypeNe, global.constCommon.dictType.baseDeptType, '', false)
    }
    home.selectWrapper.deptSubtitle = subtitle
    home.selectWrapper.dept = wrapper
    home.$refs.tableDrawerDept.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    })
  },
  /**
   * @Description：科室地址选择-单个
   * @Date 2023-10-17
   * @param confirm 确认回调函数
   * @param deptId 科室id 必须
   */
  deptAddress(confirm, deptId = -1) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    let subtitle = '所有科室地址'
    if (global.strings.isNotBlank(deptId)) {
      wrapper.eq('deptId', deptId)
      subtitle = '当前科室所属的地址'
    }
    home.selectWrapper.deptAddressSubtitle = subtitle
    home.selectWrapper.deptAddress = wrapper
    home.$refs.tableDrawerDeptAddress.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    })
  },
  /**
   * @Description：试剂组选择-单个
   * @Date 2023-10-17
   * @param confirm 确认回调函数
   */
  reagentTeam(confirm, deptId = -1) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    let subtitle = '所有试剂组'
    if (global.strings.isNotBlank(deptId)) {
      wrapper.eq('deptId', deptId)
      subtitle = '当前科室所属的试剂组'
    }
    home.selectWrapper.reagentTeamSubtitle = subtitle
    home.selectWrapper.reagentTeam = wrapper
    home.$refs.tableDrawerReagentTeam.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    })
  },
  /**
   * @Description：商品选择-单个
   * @Date 2023-10-24
   * @param confirm确认回调函数
   */
  matr(confirm) {
    let home = global.vue.$children[0].$children[0]
    home.selectWrapper.matrSubtitle = '所有在用商品'
    home.selectWrapper.matrPropUserParam = {}
    home.selectWrapper.matr = null
    home.$refs.tableDrawerMatr.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    }, false)
  },
  /**
   * @Description：商品选择-多选
   * @Date 2023-10-24
   * @param confirm 确认回调函数
   * @param supplierId 供应商id
   * @param userParam 用户参数
   * @param matrBaseType 商品基础分类
   * @param flagConsignment 是否寄售
   * @param flagOmoc 是否标签管理
   * @param notInTable      notin 的主表
   * @param notInField      notin 的字段
   * @param mainTableId      notin 的主表主键
   * @param flagDisabledSp   供应商是否禁用
   */
  matrMore(confirm, userParam,  supplierId, matrBaseType, flagConsignment, flagOmoc, notInTable, notInField, mainTableId, flagDisabledSp = false) {
    let wrapper = global.$newWrapper()
    let subtitle = '<span class="span-msg">在用耗材</span>'

    if (global.constCommon.dictType.baseMatrTypeLom ==  matrBaseType) {
      supplierId = null
      flagConsignment = null
      flagOmoc = null
      flagDisabledSp = null
    }

    if (global.strings.isNotBlank(supplierId)) {
      wrapper.eq('supplierId', supplierId)
      subtitle+='<span class="span-msg">当前供应商</span>'
    }
    if (global.strings.isNotBlank(matrBaseType)) {
      wrapper.eq('matrBaseType', matrBaseType)
      subtitle+=`<span class="span-msg">商品类型:${global.utils.getDictLabel(matrBaseType, global.constCommon.dictType.baseMatrType, '耗材', false)}</span>`
    }

    if (global.strings.isNotBlank(flagConsignment)) {
      wrapper.eq('flagConsignment', flagConsignment)
      if (global.constCommon.trueValueList.includes(flagConsignment)) {
        subtitle+='<span class="span-msg">代销</span>'
      } else {
        subtitle+='<span class="span-msg">购销</span>'
      }
    }
    if (global.strings.isNotBlank(flagOmoc)) {
      wrapper.eq('flagOmoc', flagOmoc)
      if (global.constCommon.trueValueList.includes(flagOmoc)) {
        subtitle+='<span class="span-msg">标签管理</span>'
      } else {
        subtitle+='<span class="span-msg">非标签管理</span>'
      }
    }
    if (global.strings.isNotBlank(flagDisabledSp)) {
      wrapper.eq('flagDisabledSp', flagDisabledSp)
      if (global.constCommon.trueValueList.includes(flagDisabledSp)) {
        subtitle+='<span class="span-msg">供应商已禁用</span>'
      } else {
        subtitle+='<span class="span-msg">供应商未禁用</span>'
      }
    }
    let home = global.vue.$children[0].$children[0]
    home.selectWrapper.matrMoreSubtitle = subtitle
    home.selectWrapper.matrMorePropUserParam = userParam
    home.selectWrapper.matrMore = wrapper
    home.$refs.tableDrawerMatrMore.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    }, true)
  },
  /**
   * @Description：商品选择-多选 科室相关业务
   * @Date 2023-10-24
   * @param confirm 确认回调函数
   * @param deptIdApply       申请科室id
   * @param warehouseIdStock 配送仓库id
   * @param notInTable      notin 的主表
   * @param notInField      notin 的字段
   * @param mainTableId      notin 的主表主键
   * @param matrBaseType      商品基础分类
   * @param busType      业务类型
   */
  matrMoreForDept(confirm, deptIdApply = -1, warehouseIdStock = -1, notInTable, notInField, mainTableId, matrBaseType, busType, isAllowOverApply) {
    let home = global.vue.$children[0].$children[0]
    let useParam = {
      deptIdApply: deptIdApply,
      warehouseIdStock: warehouseIdStock,
      busType: busType,
      isAllowOverApply: isAllowOverApply
    }
    let subtitle = '所有在用商品'
    if (global.strings.isNotBlank(notInTable)  && global.strings.isNotBlank(notInField) && global.strings.isNotBlank(mainTableId)) {
      useParam.sqlFilterMatr = ` and matr.id not in ( select matr_id from ${notInTable} where ${notInField} = '${mainTableId}') `
      subtitle+=',当前单据未使用'
    }

    let wrapper = global.$newWrapper()
    if (global.strings.isNotBlank(matrBaseType)) {
      wrapper.eq('matrBaseType', matrBaseType)
      subtitle+=',商品类型:' + global.utils.getDictLabel(matrBaseType, global.constCommon.dictType.baseMatrType, '', false)
    }
    home.selectWrapper.matr = wrapper
    home.selectWrapper.matrSubtitle = subtitle
    home.selectWrapper.matrPropUserParam = useParam
    home.$refs.tableDrawerMatr.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    }, true)
  },
  /**
   * @Description：商品模板-多选
   * @Date 2023-10-24
   * @param confirm 确认回调函数
   * @param deptId 科室id
   * @param packTypeEq 模板类型
   * @param supplierId 供应商id
   */
  matrPackTempletMore(confirm, deptId  = -1, packTypeEq, supplierId) {
    let home = global.vue.$children[0].$children[0]
    home.selectWrapper.matrPackTempletPropUserParam = {
      deptId: deptId
    }
    let wrapper = global.$newWrapper()
    let subtitle = '当前科室所拥有的'
    if (global.strings.isNotBlank(packTypeEq)) {
      wrapper.eq('packType', packTypeEq)
      subtitle+=', 模板类型:' + global.utils.getDictLabel(packTypeEq, global.constCommon.dictType.tempType, '', false)
    }
    if (global.strings.isNotBlank(supplierId)) {
      wrapper.eq('supplierId', supplierId)
      subtitle+=', 所属供应商'
    }
    home.selectWrapper.matrPackTemplet = wrapper
    home.selectWrapper.matrPackTempletSubtitle = subtitle
    home.$refs.tableDrawerMatrPackTemplet.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    }, true)
  },
  /**
   * @Description：商品单位选择-单个
   * @Date 2023-10-24
   * @param confirm   确认回调函数
   * @param matrId   商品id
   * @param flagApply   是否为申请单位
   * @param flagPurchase   是否为采购单位
   */
  matrUnit(confirm, matrId = -1, flagApply, flagPurchase) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    let subtitle = '当前商品的'
    wrapper.eq('matrId', matrId)
    if (global.strings.isNotBlank(flagApply)) {
      wrapper.eq('flagApply', flagApply)
      subtitle += global.constCommon.trueValueList.includes(flagApply) ? ',请领单位' : ',非请领单位'
    }
    if (global.strings.isNotBlank(flagPurchase)) {
      wrapper.eq('flagPurchase', flagPurchase)
      subtitle += global.constCommon.trueValueList.includes(flagPurchase) ? ',采购单位' : ',非采购单位'
    }
    home.selectWrapper.unit = wrapper
    home.selectWrapper.unitSubtitle = subtitle
    home.$refs.tableDrawerUnit.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    })
  },

  /**
   * @Description：员工选择-单选
   * @Date 2023-10-24
   * @param confirm   确认回调函数
   */
  staff(confirm) {
    let home = global.vue.$children[0].$children[0]
    home.selectWrapper.staffSubtitle = '所有在用员工'
    home.$refs.tableDrawerStaff.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    })
  },

   /**
   * @Description：患者选择-单选
   * @Date 2023-10-24
   * @param confirm   确认回调函数
   */
   patient(confirm) {
    let home = global.vue.$children[0].$children[0]
     home.selectWrapper.patientSubtitle = '所有在用病人'
    home.$refs.tableDrawerPatient.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    })
  },
  /**
   * @Description：采购订单选择-单个
   * @Date 2023-10-17
   * @param confirm 确认回调函数
   * @param notAllIn true: 筛选未完全入库的
   */
  purchaseOrder(confirm, notAllIn = true) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    home.selectWrapper.purchaseOrderSubtitle = '所有订单'
    if (notAllIn) {
      wrapper.eq('flow_status', 'end')
      wrapper.ne('status_in', '2')
      home.selectWrapper.purchaseOrderSubtitle = '未完全入库订单'
    }
    home.selectWrapper.purchaseOrder = wrapper
    home.$refs.tableDrawerPurchaseOrder.show((row) => {
      if (confirm) {
        confirm(row)
      }
    })
  },
  /**
   * @Description：请领需求库存-多个
   * @Date 2023-10-17
   * @param confirm 确认回调函数
   * @param notAllIn true: 筛选未完全入库的
   */
  stockApplyDemandMore(confirm, deptId = -1, warehouseId = -1) {
    let home = global.vue.$children[0].$children[0]
    home.selectWrapper.stockApplyDemandPropUserParam = {
      deptId: deptId,
      warehouseId: warehouseId
    }
    home.selectWrapper.stockApplyDemandSubtitle = '当前仓库安全库存、请领信息、采购、入库汇总'
    home.$refs.tableDrawerStockApplyDemand.show((row) => {
      if (confirm) {
        confirm(row)
      }
    }, true)
  },
  /**
   * @Description：选择库存-单选
   * @Date 2023-10-17
   * @param confirm 确认回调函数
   * @param warehouseId 仓库id
   * @param flagOmoc 是否一物一码/标签管理
   * @param isExpDateValid 是否筛选未过期的库存
   * @param isUnlock 是否筛选未锁定的库存
   * @param packageQty 包装数量
   * @param matrType 耗材类型
   * @param flagConsignment 寄售
   * @param supplierId 供应商
   */
  stock(confirm,
            warehouseId = -1,
            flagOmoc,
            isExpDateValid = true,
            isUnlock = true,
            packageQty,
            matrType,
            flagConsignment,
            supplierId,
  ) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    let subtitle = '该单据所属仓库,包装数量大于0'
    wrapper.eq('warehouseId', warehouseId)
    wrapper.ne('packageQty', 0)
    if (global.strings.isNotBlank(flagOmoc)) {
      wrapper.eq('flagOmoc', flagOmoc)
      subtitle += global.constCommon.trueValueList.includes(flagOmoc) ? ',标签管理' : ',非标签管理'
    }
    if (global.strings.isNotBlank(packageQty)) {
      wrapper.eq('packageQty', packageQty)
      subtitle += ',包装数量：'
    }
    if (global.strings.isNotBlank(flagConsignment)) {
      wrapper.eq('flagConsignment', flagConsignment)
      subtitle += global.constCommon.trueValueList.includes(flagConsignment) ? ',寄售' : ',非寄售'
    }
    if (global.strings.isNotBlank(supplierId)) {
      wrapper.eq('supplierId', supplierId)
      subtitle += ',所选供应商：'
    }
    if (global.strings.isNotBlank(isExpDateValid)) {
      if (isExpDateValid) {
        wrapper.ge('expDate', global.dates.getCurrentDate())
      } else {
        wrapper.lt('expDate', global.dates.getCurrentDate())
      }
      subtitle += global.constCommon.trueValueList.includes(isExpDateValid) ? ',未过期' : ',已过期'
    }

    subtitle += global.constCommon.trueValueList.includes(isUnlock) ? ',未锁定' : ',已锁定'
    if (isUnlock) {
      wrapper.eq('lockQty', 0)
    } else {
      wrapper.ne('lockQty', 0)
    }
    if (global.strings.isNotBlank(matrType)) {
      wrapper.eq('matrBaseType', matrType)
      subtitle+= ',耗材类型为' + global.utils.getDictLabel(matrType, global.constCommon.dictType.baseMatrType, '', false)
    }

    home.selectWrapper.stockOne = wrapper
    home.selectWrapper.stockOneSubtitle = subtitle
    home.$refs.tableDrawerStockOne.show((row) => {
      if (confirm) {
        confirm(row)
      }
    }, false)
  },
  /**
   * @Description：选择库存-多个
   * @Date 2023-10-17
   * @param confirm 确认回调函数
   * @param warehouseId 仓库id
   * @param flagOmoc 是否一物一码/标签管理
   * @param isExpDateValid 是否筛选未过期的库存
   * @param isUnlock 是否筛选未锁定的库存
   * @param matrBaseType 耗材类型
   * @param flagConsignment 寄售
   * @param supplierId 供应商
   * @param matrType   耗材类型
   * @param inBusType   入库类型
   * @param flagMagnum   true　数量化管理　false 非数量化管理
   */
  stockMore(confirm,
            warehouseId = -1,
            flagOmoc,
            isExpDateValid = true,
            isUnlock,
            matrBaseType,
            flagConsignment,
            supplierId,
            matrType,
            inBusType,
            userParam = {},
            flagMagnum,
  ) {
    if (isUnlock == undefined) {
      isUnlock = true
    }
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    let subtitle = '包装数量大于0'

    if (global.constCommon.dictType.baseMatrTypeLom ==  matrBaseType) {
      supplierId = null
      flagConsignment = null
      flagOmoc = null
      isExpDateValid = null
    }

    if (global.strings.isNotBlank(warehouseId)) {
      subtitle+=',该单据所属仓库'
      wrapper.eq('warehouseId', warehouseId)
    }

    wrapper.ne('packageQty', 0)
    if (global.strings.isNotBlank(flagOmoc)) {
      wrapper.eq('flagOmoc', flagOmoc)
      subtitle += global.constCommon.trueValueList.includes(flagOmoc) ? ',标签管理' : ',非标签管理'
    }
    if (global.strings.isNotBlank(flagConsignment)) {
      wrapper.eq('flagConsignment', flagConsignment)
      subtitle += global.constCommon.trueValueList.includes(flagConsignment) ? ',寄售' : ',非寄售'
    }
    if (global.strings.isNotBlank(flagMagnum)) {
      if (!userParam) {
        userParam = {}
      }
      userParam.flagMagnum = global.constCommon.trueValueList.includes(flagMagnum) ? '1' : '0'
      subtitle += global.constCommon.trueValueList.includes(flagMagnum) ? ',数量化管理' : ',非数量化管理'
    }
    if (global.strings.isNotBlank(supplierId)) {
      wrapper.eq('supplierId', supplierId)
      subtitle += ',所选供应商：'
    }
    if (global.strings.isNotBlank(isExpDateValid)) {
      if (isExpDateValid) {
        wrapper.ge('expDate', global.dates.getCurrentDate())
      } else {
        wrapper.lt('expDate', global.dates.getCurrentDate())
      }
      subtitle += global.constCommon.trueValueList.includes(isExpDateValid) ? ',未过期' : ',已过期'
    }

    if (global.strings.isNotBlank(isUnlock) && isUnlock != -1) {
      subtitle += global.constCommon.trueValueList.includes(isUnlock) ? ',未锁定' : ',已锁定'
      if (isUnlock) {
        wrapper.gt('skuQtyUsable', 0)
      } else {
        wrapper.le('skuQtyUsable', 0)
      }
    }

    if (global.strings.isNotBlank(matrBaseType)) {
      wrapper.eq('matrBaseType', matrBaseType)
      subtitle+= ',耗材类型为' + global.utils.getDictLabel(matrBaseType, global.constCommon.dictType.baseMatrType, '', false)
    }
    if (global.strings.isNotBlank(inBusType)) {
      wrapper.eq('inBusType', inBusType)
      subtitle+= ',入库类型为' + global.utils.getDictLabel(matrBaseType, global.constCommon.dictType.wmInOrderType, '', false)
    }
    if (global.strings.isNotBlank(matrType)) {
      wrapper.eq('matrType', matrType)
      subtitle+= ',包库存'
    }
    home.selectWrapper.stock = wrapper
    home.selectWrapper.stockSubtitle = subtitle
    home.selectWrapper.stockPropUserParam = userParam
    home.$refs.tableDrawerStock.show((row) => {
      if (confirm) {
        confirm(row)
      }
    }, true)
  },
  /**
   * @Description：手术单选择-单个
   * @Date 2023-10-17
   * @param confirm 确认回调函数
   */
  oprt(confirm) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    home.selectWrapper.oprt = wrapper
    home.$refs.tableDrawerOprt.show((row) => {
      if (confirm) {
        confirm(row)
      }
    })
  },
  /**
   * @Description：HIS计费记录-单个
   * @Date 2023-10-17
   * @param confirm 确认回调函数
   */
  hisBill(confirm) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    home.selectWrapper.hisBill = wrapper
    home.$refs.tableDrawerHisBill.show((row) => {
      if (confirm) {
        confirm(row)
      }
    })
  },

   /**
   * @Description：选择库位-单个
   * @Date 2024-04-17
   * @param confirm 确认回调函数
   * @param warehouseId 仓库id
   */
   location(confirm,  warehouseId = -1,) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    let subtitle = '盘点仓库下面的所有库位'
    wrapper.eq('warehouseId', warehouseId)
    home.selectWrapper.location = wrapper
    home.selectWrapper.locationSubtitle = subtitle
    home.$refs.tableDrawerLocation.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    })
  },
  /**
   * @Description：设备资产选择-多选
   * @Date 2023-10-24
   * @param confirm 确认回调函数
   * @param deptIdUse 使用科室
   * @param flagLock  是否锁定
   * @param deviceStatusEq  状态等于
   * @param busType  业务类型
   * @param titleAppend  追加子标题
   * @param deviceStatusNe  状态不等于
   */
  deviceMore(confirm, deptIdUse, flagLock  = 0,deviceStatusEq = 'in_use', busType = '', titleAppend = '',deviceStatusNe, UserParam = {}) {
    let wrapper = global.$newWrapper()
    let subtitle = '设备列表'
    if (global.strings.isNotBlank(deptIdUse)) {
      wrapper.eq('deptIdUse', deptIdUse)
      subtitle+=', 使用科室'
    }
    if (global.strings.isNotBlank(flagLock)) {
      wrapper.eq('flagLock', flagLock)
      subtitle+=', 未锁定'
    }

    if (global.strings.isNotBlank(deviceStatusEq)) {
      wrapper.eq('deviceStatus', deviceStatusEq)
      subtitle+= ',设备状态为' + global.utils.getDictLabel(deviceStatusEq, global.constCommon.dictType.deviceRunStatus, '', false)
    }

    if (global.strings.isNotBlank(deviceStatusNe)) {
      wrapper.ne('deviceStatus', deviceStatusNe)
      subtitle+= ',设备状态非' + global.utils.getDictLabel(deviceStatusNe, global.constCommon.dictType.deviceRunStatus, '', false)
    }

    if (global.strings.isNotBlank(titleAppend)) {
      subtitle+= ',' + titleAppend
    }

    let home = global.vue.$children[0].$children[0]
    home.selectWrapper.deviceMoreSubtitle = subtitle
    home.selectWrapper.deviceMore = wrapper
    if (!UserParam) {
      UserParam = {}
    }
    UserParam.busType = busType
    home.selectWrapper.deviceMorePropUserParam = UserParam
    home.$refs.tableDrawerDeviceMore.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    }, true)
  },
  /**
   * @Description：设备资产选择-单选
   * @Date 2023-10-24
   * @param confirm 确认回调函数
   * @param deptIdUse 使用科室
   * @param flagLock  是否锁定
   * @param deviceStatusEq  状态等于
   * @param busType  业务类型
   * @param titleAppend  追加子标题
   * @param deviceStatusNe  状态不等于
   */
  deviceOne(confirm, deptIdUse, flagLock  = 0,deviceStatusEq = 'in_use', busType = '', titleAppend = '',deviceStatusNe, UserParam = {}) {
    let wrapper = global.$newWrapper()
    let subtitle = '设备列表'
    if (global.strings.isNotBlank(deptIdUse)) {
      wrapper.eq('deptIdUse', deptIdUse)
      subtitle+=', 使用科室'
    }
    if (global.strings.isNotBlank(flagLock)) {
      wrapper.eq('flagLock', flagLock)
      subtitle+=', 未锁定'
    }

    if (global.strings.isNotBlank(deviceStatusEq)) {
      wrapper.eq('deviceStatus', deviceStatusEq)
      subtitle+= ',设备状态为' + global.utils.getDictLabel(deviceStatusEq, global.constCommon.dictType.deviceRunStatus, '', false)
    }

    if (global.strings.isNotBlank(deviceStatusNe)) {
      wrapper.ne('deviceStatus', deviceStatusNe)
      subtitle+= ',设备状态非' + global.utils.getDictLabel(deviceStatusNe, global.constCommon.dictType.deviceRunStatus, '', false)
    }

    if (global.strings.isNotBlank(titleAppend)) {
      subtitle+= ',' + titleAppend
    }

    let home = global.vue.$children[0].$children[0]
    home.selectWrapper.deviceOneSubtitle = subtitle
    home.selectWrapper.deviceOne = wrapper
    if (!UserParam) {
      UserParam = {}
    }
    UserParam.busType = busType
    home.selectWrapper.deviceOnePropUserParam = UserParam
    home.$refs.tableDrawerDeviceOne.show((row, refName) => {
      if (confirm) {
        confirm(row, refName)
      }
    }, false)
  },

  /**
   * @Description：调价明细报表
   * @Date 2024-04-17
   * @param matrId 商品id
   * @param  hisCode  商品his编码
   */
  openReportAdjust(matrId, hisCodeBefore) {
    let home = global.vue.$children[0].$children[0]
    let wrapper = global.$newWrapper()
    let subtitle = ''
    if (global.strings.isNotBlank(matrId)) {
      subtitle += '<span class="span-msg">所选商品</span>'
      wrapper.eq('matrId', matrId)
    }
    if (global.strings.isNotBlank(hisCodeBefore)) {
      subtitle += '<span class="span-msg">所选收费项目</span>'
      wrapper.eq('hisCodeBefore', hisCodeBefore)
    }

    wrapper.orderByDesc('adjustKey')

    home.selectWrapper.reportAdjustSubtitle = subtitle
    home.$refs.customDrawerReportAdjust.show()
    home.$refs.customDrawerReportAdjustReport.fetchData(true, wrapper)
  },

  /**
   * @Description：新增并选择窗口 厂商
   * @Date 2024-04-17
   * @param matrId 商品id
   * @param  hisCode  商品his编码  'base_mfg', 'base/mfg/detail.vue'
   */
  openSelectCreateFormMfg(afterSave) {
    let home = global.vue.$children[0].$children[0]
    home.openSelectCreateForm('厂商', 'base_mfg','base/mfg/detail.vue', afterSave)
  },

  /**
   * @Description：新增并选择窗口 供应商
   * @Date 2024-04-17
   * @param matrId 商品id
   * @param  hisCode  商品his编码  'base_mfg', 'base/mfg/detail.vue'
   */
  openSelectCreateFormSp(afterSave) {
    let home = global.vue.$children[0].$children[0]
    home.openSelectCreateForm('供应商', 'base_supplier','base/supplier/detail.vue', afterSave)
  },

}

setTimeout(() => {
  // utilSelect.matr()
  // utilSelect.stock()
}, 5000)

export default utilSelect
